import { createApp } from 'vue'
import App from './App.vue'
import dayjs from 'dayjs'
import router from './router'
import store from './store'
import './style/common.css'

import { 
  Button, 
  NavBar, 
  Icon, 
  Form, 
  Field, 
  CellGroup, 
  Popup, 
  DatetimePicker, 
  List, 
  PullRefresh, 
  Cell,
  NumberKeyboard,
  Dialog, 
  Tabbar, 
  TabbarItem,
  Progress
} from 'vant'

const app = createApp(App)

// 全局的时间过滤器
app.config.globalProperties.$filters = {
  transTime(date) {
    return dayjs(Number(date)).format('HH:mm')
  },
  transDay(value) {
    return dayjs(value).format('MM-DD')
  },
  transYDM(value) {
    return dayjs(value).format('YYYY-MM-DD HH:mm')
  }
}

app.use(Dialog)
app.use(Progress)
app.use(Tabbar)
app.use(TabbarItem)
app.use(NumberKeyboard)
app.use(Cell)
app.use(Button)
app.use(PullRefresh)
app.use(List)
app.use(DatetimePicker)
app.use(Popup)
app.use(Icon)
app.use(NavBar)
app.use(Form)
app.use(Field)
app.use(CellGroup)
app.use(store)
app.use(router)

app.mount('#app')
